import java.util.Random;
import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Random rand = new Random();
        int a = rand.nextInt(100)+1;//rand范围从零开始需要猜1到100就+1
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字");
        while(true) {

            int b = sc.nextInt();
            if (a > b) {
                System.out.println("猜小了");
            }
            if (a < b) {
                System.out.println("猜大了");
            }
            if (a == b) {
                System.out.println("猜中了");
                break;//猜到就跳出循环
            }
        }
    }
}
